<template>
	<view class="content">
		<view class="section-0">
			<view class="section-body">
				<view class="frequency">会议名称：<br><span>{{name}}</span></view>
			</view>
		</view>
		<view class="section-1">
			<timeLine :list="list"></timeLine>
		</view>
	</view>
</template>

<script>
	const meetingMap = {
		// meeting_type: {
		// 	type:'text',
		// 	name: '会议类型',
		// 	filter: (val) => {
		// 		let str = str;
		// 		switch (val) {
		// 			case "1":
		// 				str = '例会';
		// 				break;
		// 			case "2":
		// 				str = '站班会';
		// 				break;
		// 			case "3":
		// 				str = '安委会';
		// 				break;
		// 			case "5":
		// 				str = '启委会';
		// 				break;
		// 			case "6":
		// 				str = '工程月例会';
		// 				break;
		// 			case "7":
		// 				str = '第一次工地例会';
		// 				break;
		// 			default:
		// 				str = val;
		// 				break;
		// 		}
		// 		return str;
		// 	}
		// },
		meeting_time: {
			type:'text',
			name: '会议时间',
			filter: (val) => val.substring(0, 10)
		},
		meeting_duration: {
			type:'text',
			name: '会议时长',
			filter: (val) => {
				// val=1
				if(val==null){
					return ""
				}else{
					return val + '分钟'
				}
				
			}
		},
		meet_file_content: {
			type:'text',
			name: '会议内容',
			filter: (val) => {
				return val
			}
		},
		// meeting_file_id:{
		// 	type:'image',
		// 	name:'会议现场',
		// 	filter: (val) => {
		// 		return val
		// 	}
		// },
		meeting_file_path:{
			type:'image',
			name:'会议照片',
			filter: (val) => {
				return [{
					url:val
				}]
			}
		},
		meeting_av_path:{
			type:'video',
			name:'会议视频',
			filter: (val) => {
				return [{
					url:val
				}]
			}
		},
		meeting_audio_path:{
			type:'audio',
			name:'会议录音',
			filter: (val) => {
				return [{
					url:val
				}]
			}
		},
		
	}
	import {
		meettingDetailsApi
	} from '@/api/duty.js';
	import {
		mapGetters,
		mapActions
	} from 'vuex';
	import timeLine from '@/components/time_line/index.vue';
	export default {
		components: {
			timeLine
		},
		data() {
			return {
				name: '',
				list: []
			};
		},
		methods: {
			go(item) {
				uni.navigateTo({
					url: item.path
				})
			},
			async fetchData() {
				uni.showLoading({
					title: '加载中...'
				});
				const {
					data
				} = await meettingDetailsApi({
					id: this.id
				});
				uni.hideLoading();
				if (data.code === 1) {
					let arr = [];
					let res = data.data;
					for (let key in meetingMap) {
						let item = {};
						if (meetingMap[key]) {
							var type=meetingMap[key].type
							item = {title: meetingMap[key].name,
								content: {
									type: type,
									value: meetingMap[key].filter(res[key])
								}
							}
													
							if(res[key]!=null){
								arr.push(item);	
							}
						}
					}
					this.list = arr;
					// { title: 'name15', content: { type: 'image', value: [
					// 	{url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbj-yuantu.fotomore.com%2Fcreative%2Fvcg%2Fnew%2FVCG211346369046.jpg%3FExpires%3D1643621488%26OSSAccessKeyId%3DLTAI2pb9T0vkLPEC%26Signature%3DmmAY3rFIBlPkCIkgbyos7hGfGmM%253D%26x-oss-process%3Dimage%252Fauto-orient%252C0%252Fsaveexif%252C1%252Fresize%252Cm_lfit%252Ch_1200%252Cw_1200%252Climit_1%252Fsharpen%252C100%252Fquality%252CQ_80%252Fwatermark%252Cg_se%252Cx_0%252Cy_0%252Cimage_d2F0ZXIvdmNnLXdhdGVyLTIwMDAucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2UvcmVzaXplLG1fbGZpdCxoXzE3MSx3XzE3MSxsaW1pdF8x%252F&refer=http%3A%2F%2Fbj-yuantu.fotomore.com&app=2002&size=f10000,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1645717275&t=ccfb260566501525fdf2fbe3de39226e"},
					// 	{url: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fbj-yuantu.fotomore.com%2Fcreative%2Fvcg%2Fnew%2FVCG211346369046.jpg%3FExpires%3D1643621488%26OSSAccessKeyId%3DLTAI2pb9T0vkLPEC%26Signature%3DmmAY3rFIBlPkCIkgbyos7hGfGmM%253D%26x-oss-process%3Dimage%252Fauto-orient%252C0%252Fsaveexif%252C1%252Fresize%252Cm_lfit%252Ch_1200%252Cw_1200%252Climit_1%252Fsharpen%252C100%252Fquality%252CQ_80%252Fwatermark%252Cg_se%252Cx_0%252Cy_0%252Cimage_d2F0ZXIvdmNnLXdhdGVyLTIwMDAucG5nP3gtb3NzLXByb2Nlc3M9aW1hZ2UvcmVzaXplLG1fbGZpdCxoXzE3MSx3XzE3MSxsaW1pdF8x%252F&refer=http%3A%2F%2Fbj-yuantu.fotomore.com&app=2002&size=f10000,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1645717275&t=ccfb260566501525fdf2fbe3de39226e"},
					// ]}},
				}
			}
		},
		onLoad(data) {
			this.id = JSON.parse(data.params).id;
			this.name = JSON.parse(data.params).meeting_name;
		},
		onReady() {
			this.fetchData();
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		background-color: #fff;
	}

	.section-0 {
		width: 100%;
		background-color: #3a5cf4;

		.section-body {
			width: 100%;
			padding-left: 40rpx;
			height: 180rpx;
			padding-right: 40rpx;
			padding-bottom: 50rpx;
			background-color: #1534ce;
			background-size: cover;
			background-repeat: no-repeat;
			border-top-left-radius: 50rpx;
			border-top-right-radius: 50rpx;
			overflow: hidden;
			box-sizing: border-box;

			.frequency {
				margin-top: 15rpx;
				width: 100%;
				height: 180rpx;
				line-height: 50rpx;
				font-size: 26rpx;
				color: #87c6ff;

				span {
					color: #fff;
				}
			}
		}
	}

	.section-1 {
		position: relative;
		top: -50rpx;
		z-index: 10;
		background-color: #fff;
		border-top-left-radius: 50rpx;
		border-top-right-radius: 50rpx;
		box-sizing: border-box;
		padding: 0 40rpx;
		padding-top: 60rpx;
	}
</style>
